const Router = require("koa-router");
const { userValidator, verifyUser } = require("../middleware/user.middleware");
const { register, login } = require("../controller/user.controller");

// new Router({prefix: '/users'})中的prefix相当于在请求连接前加上前缀
// 加上前缀后的路径/users/
const router = new Router({
  prefix: "/users",
});
// 注册(先经过中间件处理,通过之后向下流转)
router.post("/register", userValidator, verifyUser, register);

// 登录
router.post("/login", login);

module.exports = router;
